<?php
namespace app\admin\model;

use think\Model;

class Menu extends Model
{
    public function getList($title, $order, $page, $pageSize){
        $data = $this->field('a.id,a.title,a.pid,a.order,a.status,a.create_time,a.update_time,b.title as p_title')->alias('a')->join('tb_menu b','a.pid = b.id','LEFT')->where('a.title','like',"%$title%")->page($page,$pageSize)->order("$order[0] $order[1]")->select();
        return $data;
    }

    public function listCount($title){
        $count = $this->where('title','like',"%$title%")->count();
        return $count;
    }
}